import Taro, { Component } from '@tarojs/taro'
import { Button, Image, Text, View } from '@tarojs/components'
import './index.scss'
import classNames from 'classnames'
import { toGoodsPage } from "@/utils/page_router"
import { OSS } from "@/config/config"

// const fun = function () {}
const prefixCls = 'group-join'
export default class GroupJoin extends Component {
  state:any
  props:any

  static options = {
    addGlobalClass: true
  }

  render() {
    const { isOpened, onClose, goodsInfo } = this.props
    const bool = isOpened ? 'enter' : 'leave'
    // @ts-ignore
    return isOpened && (<View catchtouchmove>
      <View className={`xf-overlay xf-fade-${bool}`} onClick={() => onClose()}/>
      <View className={classNames(`xf-popup xf-popup--center xf-popup--round ${prefixCls}`, {
        [`xf-fade-${bool}`]: !isOpened,
      })}>
        <Image mode='widthFix' src={`${OSS}/system/image/tips_bg.png`} className='xf-bg-img'/>
        <View className={`${prefixCls}__head`}>有拼团进行中</View>
        <View className={`${prefixCls}__body`}>
          <Text className={`${prefixCls}__content`}>
            您有一笔进行中的拼团订单!
          </Text>
        </View>
        <View className={`${prefixCls}__foot d-f j-c-b`}>
          <Button className={`${prefixCls}__btn xf-btn xf-btn-round`} onClick={() => onClose()}>取消</Button>
          <Button className={`${prefixCls}__btn xf-btn xf-btn-round xf-btn-primary`} onClick={() => toGoodsPage(goodsInfo)}>前往</Button>
        </View>
      </View>
    </View>)
  }
}
